import Vue from 'vue'
import Vuex from 'vuex'
import cartModule from "./cartModule";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count:0
  },
  mutations: {
    plus(state){
      state.count++
    },
    minus(state){
      if(state.count===0){
        return;
      }
      state.count--;
    }
  },
  actions: {
    plus(context){
      context.commit("plus")
    },
    minus(context){
      context.commit("minus")
    }
  },
  modules: {
    cartModule
  }
})
